//封装 request 获取数据
const apiurl = "https://www.51houniao.com";

const pagedata = {
  request(url,data,type){
    //显示旋转小图标
    wx.showLoading({
      title: '加载中...',
    })
    return new Promise((resolve,reject)=>{
      wx.request({
        url: apiurl+url,
        method: type,
        data: data,
        success:(res)=>{
          //隐藏旋转小图标
          wx.hideLoading();
          resolve(res);
        },
        fail:(err)=>{
          wx.hideLoading();
          reject(err);
        }
      })
    })
  }
}

module.exports = {
  request: pagedata.request
}